// Name:            Nav
// Description:     Defines styles for list navigations
//
// Component:       `uk-nav`
//
// Sub-objects:     `uk-nav-parent-icon`
//                  `uk-nav-header`
//                  `uk-nav-divider`
//                  `uk-nav-subtitle`
//                  `uk-nav-sub`
//
// Modifiers:       `uk-nav-default`
//                  `uk-nav-primary`
//                  `uk-nav-center`,
//                  `uk-nav-divider`
//
// States:          `uk-active`
//                  `uk-parent`
//                  `uk-open`
//                  `uk-touch`
//
// ========================================================================


// Variables
// ========================================================================

@nav-item-padding-vertical:                     5px;
@nav-item-padding-horizontal:                   0;

@nav-sublist-padding-vertical:                  5px;
@nav-sublist-padding-left:                      15px;
@nav-sublist-deeper-padding-left:               15px;
@nav-sublist-item-padding-vertical:             2px;

@nav-parent-icon-margin-left:                   0.25em;

@nav-header-padding-vertical:                   @nav-item-padding-vertical;
@nav-header-padding-horizontal:                 @nav-item-padding-horizontal;
@nav-header-font-size:                          @global-small-font-size;
@nav-header-text-transform:                     uppercase;
@nav-header-margin-top:                         @global-margin;

@nav-divider-margin-vertical:                   5px;
@nav-divider-margin-horizontal:                 0;

@nav-default-font-size:                         @global-font-size;
@nav-default-line-height:                       @global-line-height;
@nav-default-item-color:                        @global-muted-color;
@nav-default-item-hover-color:                  @global-color;
@nav-default-item-active-color:                 @global-emphasis-color;
@nav-default-subtitle-font-size:                @global-small-font-size;
@nav-default-header-color:                      @global-emphasis-color;
@nav-default-divider-border-width:              @global-border-width;
@nav-default-divider-border:                    @global-border;
@nav-default-sublist-font-size:                 @nav-default-font-size;
@nav-default-sublist-line-height:               @nav-default-line-height;
@nav-default-sublist-item-color:                @global-muted-color;
@nav-default-sublist-item-hover-color:          @global-color;
@nav-default-sublist-item-active-color:         @global-emphasis-color;

@nav-primary-font-size:                         @global-large-font-size;
@nav-primary-line-height:                       @global-line-height;
@nav-primary-item-color:                        @global-muted-color;
@nav-primary-item-hover-color:                  @global-color;
@nav-primary-item-active-color:                 @global-emphasis-color;
@nav-primary-subtitle-font-size:                @global-medium-font-size;
@nav-primary-header-color:                      @global-emphasis-color;
@nav-primary-divider-border-width:              @global-border-width;
@nav-primary-divider-border:                    @global-border;
@nav-primary-sublist-font-size:                 @global-medium-font-size;
@nav-primary-sublist-line-height:               @global-line-height;
@nav-primary-sublist-item-color:                @global-muted-color;
@nav-primary-sublist-item-hover-color:          @global-color;
@nav-primary-sublist-item-active-color:         @global-emphasis-color;

@nav-secondary-font-size:                       @global-font-size;
@nav-secondary-line-height:                     @global-line-height;
@nav-secondary-item-color:                      @global-emphasis-color;
@nav-secondary-item-hover-color:                @global-emphasis-color;
@nav-secondary-item-active-color:               @global-emphasis-color;
@nav-secondary-subtitle-font-size:              @global-small-font-size;
@nav-secondary-subtitle-color:                  @global-muted-color;
@nav-secondary-subtitle-hover-color:            @global-color;
@nav-secondary-subtitle-active-color:           @global-emphasis-color;
@nav-secondary-header-color:                    @global-emphasis-color;
@nav-secondary-divider-border-width:            @global-border-width;
@nav-secondary-divider-border:                  @global-border;
@nav-secondary-sublist-font-size:               @global-small-font-size;
@nav-secondary-sublist-line-height:             @global-line-height;
@nav-secondary-sublist-item-color:              @global-muted-color;
@nav-secondary-sublist-item-hover-color:        @global-color;
@nav-secondary-sublist-item-active-color:       @global-emphasis-color;

@nav-dividers-margin-top:                       5px;
@nav-dividers-border-width:                     @global-border-width;
@nav-dividers-border:                           @global-border;


/* ========================================================================
   Component: Nav
 ========================================================================== */

/*
 * Reset
 */

.uk-nav,
.uk-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

/*
* 1. Center content vertically, e.g. an icon
* 2. Imitate white space gap when using flexbox
* 3. Reset link
 */

.uk-nav li > a {
    /* 1 */
    display: flex;
    align-items: center;
    /* 2 */
    column-gap: 0.25em;
    /* 3*/
    text-decoration: none;
}

/*
 * Items
 * Must target `a` elements to exclude other elements (e.g. lists)
 */

.uk-nav > li > a { padding: @nav-item-padding-vertical @nav-item-padding-horizontal; }


/* Sublists
 ========================================================================== */

/*
 * Level 2
 * `ul` needed for higher specificity to override padding
 */

ul.uk-nav-sub {
    padding: @nav-sublist-padding-vertical 0 @nav-sublist-padding-vertical @nav-sublist-padding-left;
    .hook-nav-sub();
}

/*
 * Level 3 and deeper
 */

.uk-nav-sub ul { padding-left: @nav-sublist-deeper-padding-left; }

/*
 * Items
 */

.uk-nav-sub a { padding: @nav-sublist-item-padding-vertical 0; }


/* Parent icon
 ========================================================================== */

.uk-nav-parent-icon {
    margin-left: auto;
    transition: transform 0.3s ease-out;
}

.uk-nav > li.uk-open > a .uk-nav-parent-icon { transform: rotateX(180deg); }


/* Header
 ========================================================================== */

.uk-nav-header {
    padding: @nav-header-padding-vertical @nav-header-padding-horizontal;
    text-transform: @nav-header-text-transform;
    font-size: @nav-header-font-size;
    .hook-nav-header();
}

.uk-nav-header:not(:first-child) { margin-top: @nav-header-margin-top; }


/* Divider
 ========================================================================== */

.uk-nav .uk-nav-divider {
    margin: @nav-divider-margin-vertical @nav-divider-margin-horizontal;
    .hook-nav-divider();
}


/* Default modifier
 ========================================================================== */

.uk-nav-default {
    font-size: @nav-default-font-size;
    line-height: @nav-default-line-height;
    .hook-nav-default();
}

/*
 * Items
 */

.uk-nav-default > li > a {
    color: @nav-default-item-color;
    .hook-nav-default-item();
}

/* Hover */
.uk-nav-default > li > a:hover {
    color: @nav-default-item-hover-color;
    .hook-nav-default-item-hover();
}

/* Active */
.uk-nav-default > li.uk-active > a {
    color: @nav-default-item-active-color;
    .hook-nav-default-item-active();
}

/*
 * Subtitle
 */

.uk-nav-default .uk-nav-subtitle {
    font-size: @nav-default-subtitle-font-size;
    .hook-nav-default-subtitle();
}

/*
 * Header
 */

.uk-nav-default .uk-nav-header {
    color: @nav-default-header-color;
    .hook-nav-default-header();
}

/*
 * Divider
 */

.uk-nav-default .uk-nav-divider {
    border-top: @nav-default-divider-border-width solid @nav-default-divider-border;
    .hook-nav-default-divider();
}

/*
 * Sublists
 */

.uk-nav-default .uk-nav-sub {
    font-size: @nav-default-sublist-font-size;
    line-height: @nav-default-sublist-line-height;
}

.uk-nav-default .uk-nav-sub a { color: @nav-default-sublist-item-color; }

.uk-nav-default .uk-nav-sub a:hover { color: @nav-default-sublist-item-hover-color; }

.uk-nav-default .uk-nav-sub li.uk-active > a { color: @nav-default-sublist-item-active-color; }


/* Primary modifier
 ========================================================================== */

.uk-nav-primary {
    font-size: @nav-primary-font-size;
    line-height: @nav-primary-line-height;
    .hook-nav-primary();
}

/*
 * Items
 */

.uk-nav-primary > li > a {
    color: @nav-primary-item-color;
    .hook-nav-primary-item();
}

/* Hover */
.uk-nav-primary > li > a:hover {
    color: @nav-primary-item-hover-color;
    .hook-nav-primary-item-hover();
}

/* Active */
.uk-nav-primary > li.uk-active > a {
    color: @nav-primary-item-active-color;
    .hook-nav-primary-item-active();
}

/*
 * Subtitle
 */

.uk-nav-primary .uk-nav-subtitle {
    font-size: @nav-primary-subtitle-font-size;
    .hook-nav-primary-subtitle();
}

/*
 * Header
 */

.uk-nav-primary .uk-nav-header {
    color: @nav-primary-header-color;
    .hook-nav-primary-header();
}

/*
 * Divider
 */

.uk-nav-primary .uk-nav-divider {
    border-top: @nav-primary-divider-border-width solid @nav-primary-divider-border;
    .hook-nav-primary-divider();
}

/*
 * Sublists
 */

.uk-nav-primary .uk-nav-sub {
    font-size: @nav-primary-sublist-font-size;
    line-height: @nav-primary-sublist-line-height;
}

.uk-nav-primary .uk-nav-sub a { color: @nav-primary-sublist-item-color; }

.uk-nav-primary .uk-nav-sub a:hover { color: @nav-primary-sublist-item-hover-color; }

.uk-nav-primary .uk-nav-sub li.uk-active > a { color: @nav-primary-sublist-item-active-color; }


/* Secondary modifier
 ========================================================================== */

.uk-nav-secondary {
    font-size: @nav-secondary-font-size;
    line-height: @nav-secondary-line-height;
    .hook-nav-secondary();
}

/*
 * Items
 */

.uk-nav-secondary > li > a {

    color: @nav-secondary-item-color;
    .hook-nav-secondary-item();
}

/* Hover */
.uk-nav-secondary > li > a:hover {
    color: @nav-secondary-item-hover-color;
    .hook-nav-secondary-item-hover();
}

/* Active */
.uk-nav-secondary > li.uk-active > a {
    color: @nav-secondary-item-active-color;
    .hook-nav-secondary-item-active();
}

/*
 * Subtitle
 */

.uk-nav-secondary .uk-nav-subtitle {
    font-size: @nav-secondary-subtitle-font-size;
    color: @nav-secondary-subtitle-color;
    .hook-nav-secondary-subtitle();
}

/* Hover */
.uk-nav-secondary > li > a:hover .uk-nav-subtitle {
    color: @nav-secondary-subtitle-hover-color;
    .hook-nav-secondary-subtitle-hover();
}

/* Active */
.uk-nav-secondary > li.uk-active > a .uk-nav-subtitle {
    color: @nav-secondary-subtitle-active-color;
    .hook-nav-secondary-subtitle-active();
}

/*
 * Header
 */

.uk-nav-secondary .uk-nav-header {
    color: @nav-secondary-header-color;
    .hook-nav-secondary-header();
}

/*
 * Divider
 */

.uk-nav-secondary .uk-nav-divider {
    border-top: @nav-secondary-divider-border-width solid @nav-secondary-divider-border;
    .hook-nav-secondary-divider();
}

/*
 * Sublists
 */

.uk-nav-secondary .uk-nav-sub {
    font-size: @nav-secondary-sublist-font-size;
    line-height: @nav-secondary-sublist-line-height;
}

.uk-nav-secondary .uk-nav-sub a { color: @nav-secondary-sublist-item-color; }

.uk-nav-secondary .uk-nav-sub a:hover { color: @nav-secondary-sublist-item-hover-color; }

.uk-nav-secondary .uk-nav-sub li.uk-active > a { color: @nav-secondary-sublist-item-active-color; }


/* Alignment modifier
 ========================================================================== */

/*
 * 1. Center header
 * 2. Center items
 */

 /* 1 */
.uk-nav-center { text-align: center; }
 /* 2 */
.uk-nav-center li > a { justify-content: center; }

/* Sublists */
.uk-nav-center .uk-nav-sub,
.uk-nav-center .uk-nav-sub ul { padding-left: 0; }

/* Parent icon  */
.uk-nav-center .uk-nav-parent-icon { margin-left: @nav-parent-icon-margin-left; }


/* Style modifier
 ========================================================================== */

/*
 * Divider
 * Naming is in plural to prevent conflicts with divider sub object.
 */

.uk-nav.uk-nav-divider > :not(.uk-nav-header, .uk-nav-divider) + :not(.uk-nav-header, .uk-nav-divider) {
    margin-top: @nav-dividers-margin-top;
    padding-top: @nav-dividers-margin-top;
    border-top: @nav-dividers-border-width solid @nav-dividers-border;
    .hook-nav-dividers();
}


// Hooks
// ========================================================================

.hook-nav-misc();

.hook-nav-sub() {}
.hook-nav-header() {}
.hook-nav-divider() {}
.hook-nav-default() {}
.hook-nav-default-item() {}
.hook-nav-default-item-hover() {}
.hook-nav-default-item-active() {}
.hook-nav-default-subtitle() {}
.hook-nav-default-header() {}
.hook-nav-default-divider() {}
.hook-nav-primary() {}
.hook-nav-primary-item() {}
.hook-nav-primary-item-hover() {}
.hook-nav-primary-item-active() {}
.hook-nav-primary-subtitle() {}
.hook-nav-primary-header() {}
.hook-nav-primary-divider() {}
.hook-nav-secondary() {}
.hook-nav-secondary-item() {}
.hook-nav-secondary-item-hover() {}
.hook-nav-secondary-item-active() {}
.hook-nav-secondary-subtitle() {}
.hook-nav-secondary-subtitle-hover() {}
.hook-nav-secondary-subtitle-active() {}
.hook-nav-secondary-header() {}
.hook-nav-secondary-divider() {}
.hook-nav-dividers() {}
.hook-nav-misc() {}


// Inverse
// ========================================================================

@inverse-nav-default-item-color:                    @inverse-global-muted-color;
@inverse-nav-default-item-hover-color:              @inverse-global-color;
@inverse-nav-default-item-active-color:             @inverse-global-emphasis-color;
@inverse-nav-default-header-color:                  @inverse-global-emphasis-color;
@inverse-nav-default-divider-border:                @inverse-global-border;
@inverse-nav-default-sublist-item-color:            @inverse-global-muted-color;
@inverse-nav-default-sublist-item-hover-color:      @inverse-global-color;
@inverse-nav-default-sublist-item-active-color:     @inverse-global-emphasis-color;

@inverse-nav-primary-item-color:                    @inverse-global-muted-color;
@inverse-nav-primary-item-hover-color:              @inverse-global-color;
@inverse-nav-primary-item-active-color:             @inverse-global-emphasis-color;
@inverse-nav-primary-header-color:                  @inverse-global-emphasis-color;
@inverse-nav-primary-divider-border:                @inverse-global-border;
@inverse-nav-primary-sublist-item-color:            @inverse-global-muted-color;
@inverse-nav-primary-sublist-item-hover-color:      @inverse-global-color;
@inverse-nav-primary-sublist-item-active-color:     @inverse-global-emphasis-color;

@inverse-nav-secondary-item-color:                  @inverse-global-emphasis-color;
@inverse-nav-secondary-item-hover-color:            @inverse-global-emphasis-color;
@inverse-nav-secondary-item-active-color:           @inverse-global-emphasis-color;
@inverse-nav-secondary-subtitle-color:              @inverse-global-muted-color;
@inverse-nav-secondary-subtitle-hover-color:        @inverse-global-color;
@inverse-nav-secondary-subtitle-active-color:       @inverse-global-emphasis-color;
@inverse-nav-secondary-header-color:                @inverse-global-emphasis-color;
@inverse-nav-secondary-divider-border:              @inverse-global-border;
@inverse-nav-secondary-sublist-item-color:          @inverse-global-muted-color;
@inverse-nav-secondary-sublist-item-hover-color:    @inverse-global-color;
@inverse-nav-secondary-sublist-item-active-color:   @inverse-global-emphasis-color;

@inverse-nav-dividers-border:                       @inverse-global-border;

.hook-inverse() {

    //
    // Default
    //

    .uk-nav-default > li > a {
        color: @inverse-nav-default-item-color;
        .hook-inverse-nav-default-item();
    }

    .uk-nav-default > li > a:hover {
        color: @inverse-nav-default-item-hover-color;
        .hook-inverse-nav-default-item-hover();
    }

    .uk-nav-default > li.uk-active > a {
        color: @inverse-nav-default-item-active-color;
        .hook-inverse-nav-default-item-active();
    }

    .uk-nav-default .uk-nav-header {
        color: @inverse-nav-default-header-color;
        .hook-inverse-nav-default-header();
    }

    .uk-nav-default .uk-nav-divider {
        border-top-color: @inverse-nav-default-divider-border;
        .hook-inverse-nav-default-divider();
    }

    .uk-nav-default .uk-nav-sub a { color: @inverse-nav-default-sublist-item-color; }

    .uk-nav-default .uk-nav-sub a:hover { color: @inverse-nav-default-sublist-item-hover-color; }

    .uk-nav-default .uk-nav-sub li.uk-active > a { color: @inverse-nav-default-sublist-item-active-color; }

    //
    // Primary
    //

    .uk-nav-primary > li > a {
        color: @inverse-nav-primary-item-color;
        .hook-inverse-nav-primary-item();
    }

    .uk-nav-primary > li > a:hover {
        color: @inverse-nav-primary-item-hover-color;
        .hook-inverse-nav-primary-item-hover();
    }

    .uk-nav-primary > li.uk-active > a {
        color: @inverse-nav-primary-item-active-color;
        .hook-inverse-nav-primary-item-active();
    }

    .uk-nav-primary .uk-nav-header {
        color: @inverse-nav-primary-header-color;
        .hook-inverse-nav-primary-header();
    }

    .uk-nav-primary .uk-nav-divider {
        border-top-color: @inverse-nav-primary-divider-border;
        .hook-inverse-nav-primary-divider();
    }

    .uk-nav-primary .uk-nav-sub a { color: @inverse-nav-primary-sublist-item-color; }

    .uk-nav-primary .uk-nav-sub a:hover { color: @inverse-nav-primary-sublist-item-hover-color; }

    .uk-nav-primary .uk-nav-sub li.uk-active > a { color: @inverse-nav-primary-sublist-item-active-color; }

    //
    // Secondary
    //

    .uk-nav-secondary > li > a {
        color: @inverse-nav-secondary-item-color;
        .hook-inverse-nav-secondary-item();
    }

    .uk-nav-secondary > li > a:hover {
        color: @inverse-nav-secondary-item-hover-color;
        .hook-inverse-nav-secondary-item-hover();
    }

    .uk-nav-secondary > li.uk-active > a {
        color: @inverse-nav-secondary-item-active-color;
        .hook-inverse-nav-secondary-item-active();
    }

    .uk-nav-secondary .uk-nav-subtitle {
        color: @inverse-nav-secondary-subtitle-color;
        .hook-inverse-nav-secondary-subtitle();
    }

    .uk-nav-secondary > li > a:hover .uk-nav-subtitle {
        color: @inverse-nav-secondary-subtitle-hover-color;
        .hook-inverse-nav-secondary-subtitle-hover();
    }

    .uk-nav-secondary > li.uk-active > a .uk-nav-subtitle {
        color: @inverse-nav-secondary-subtitle-active-color;
        .hook-inverse-nav-secondary-subtitle-active();
    }

    .uk-nav-secondary .uk-nav-header {
        color: @inverse-nav-secondary-header-color;
        .hook-inverse-nav-secondary-header();
    }

    .uk-nav-secondary .uk-nav-divider {
        border-top-color: @inverse-nav-secondary-divider-border;
        .hook-inverse-nav-secondary-divider();
    }

    .uk-nav-secondary .uk-nav-sub a { color: @inverse-nav-secondary-sublist-item-color; }

    .uk-nav-secondary .uk-nav-sub a:hover { color: @inverse-nav-secondary-sublist-item-hover-color; }

    .uk-nav-secondary .uk-nav-sub li.uk-active > a { color: @inverse-nav-secondary-sublist-item-active-color; }

    //
    // Dividers
    //

    .uk-nav.uk-nav-divider > :not(.uk-nav-divider) + :not(.uk-nav-header, .uk-nav-divider) {
        border-top-color: @inverse-nav-dividers-border;
        .hook-inverse-nav-dividers();
    }

}

.hook-inverse-nav-default-item() {}
.hook-inverse-nav-default-item-hover() {}
.hook-inverse-nav-default-item-active() {}
.hook-inverse-nav-default-header() {}
.hook-inverse-nav-default-divider() {}
.hook-inverse-nav-primary-item() {}
.hook-inverse-nav-primary-item-hover() {}
.hook-inverse-nav-primary-item-active() {}
.hook-inverse-nav-primary-header() {}
.hook-inverse-nav-primary-divider() {}
.hook-inverse-nav-secondary-item() {}
.hook-inverse-nav-secondary-item-hover() {}
.hook-inverse-nav-secondary-item-active() {}
.hook-inverse-nav-secondary-subtitle() {}
.hook-inverse-nav-secondary-subtitle-hover() {}
.hook-inverse-nav-secondary-subtitle-active() {}
.hook-inverse-nav-secondary-header() {}
.hook-inverse-nav-secondary-divider() {}
.hook-inverse-nav-dividers() {}
